const it1 = [5, 9][Symbol.iterator]();
console.log(it1.next()); // { value: 5, done: false }
console.log(it1.next()); // { value: 9, done: false }
console.log(it1.next()); // { value: undefined, done: true }
console.log(it1.next()); // { value: undefined, done: true }
function* f2() {
  for (const i of [5, 9]) yield i;
}
const it2 = f2();
console.log(it2.next()); // { value: 5, done: false }
console.log(it2.next()); // { value: 9, done: false }
console.log(it2.next()); // { value: undefined, done: true }
console.log(it2.next()); // { value: undefined, done: true }
function* f3() {
  for (const i of [5, 9]) yield i;
  return 2;
}
const it3 = f3();
console.log(it3.next()); // { value: 5, done: false }
console.log(it3.next()); // { value: 9, done: false }
console.log(it3.next()); // { value: 2, done: true }
console.log(it3.next()); // { value: undefined, done: true }
